// pages/moneyDetails/moneyDetails.js
var app = getApp();
var util = require('../../utils/util.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    loading:true
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    app.getLoginSession(function (session) {
      wx.request({
        url: app.api+'/User/getAccountLog',
        data:{
          t_session:session
        },
        success:function(res){
          var res = res.data;
          if(res.done){
            if(res.retval==null){
              that.setData({
                loading:false,
                loadTips:'暂无数据'
              })
            }else{
              that.setData({
                loading: false,
                list: that.deallist(res.retval),
                loadTips:'暂无更多数据'
              })
            }
          }
        }
      })
  })
  },
  onShow: function () {
  
  },
  deallist(list) {
    if (list && Array.isArray(list)) {
      list.forEach((item) => {
        item.addtime = util.formatDate(new Date(item.addtime * 1000), 'YYYY-MM-dd hh:mm:ss')
      })
      return list
    }
  }
})